UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r03WfQSHzkQwIJSkOqsup/J7cp1u+AuJmditDve+aww=' 
WHERE 
  key_id = '0ba0ccde836c57dd798f8d57e049a48e2046c97ab3ad261a5f6d26c81d6af650' 
  AND (
    token = 'r03WfQSHzkQwIJSkOqsup/J7cp1u+AuJmditDve+aww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027