UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PJyczvo42zFMOU1SDyS0yOlUQc8W/0rL0dper9YZl7c=' 
WHERE 
  key_id = 'abced9d74348455fcb526e27081272e52caa92fe6ad15c4373f3c7c2aec10c77' 
  AND (
    token = 'PJyczvo42zFMOU1SDyS0yOlUQc8W/0rL0dper9YZl7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039