UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UnB4kMyuombOU8KGyP39mqrB8AjbXvs0jYh/3qIs6m4=' 
WHERE 
  key_id = '1034bfd36576e2f25ba68f79925977d4534d72c2e8141a51b80137cd925cc675' 
  AND (
    token = 'UnB4kMyuombOU8KGyP39mqrB8AjbXvs0jYh/3qIs6m4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032