UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oYWLe07PI6uEk+z33fr9oo1fSACGQ5s6jddFapZ+DjI=' 
WHERE 
  key_id = 'dd45e8ec392fb0a41dd77aefcc367595660086bc12d06a40755da009082329b6' 
  AND (
    token = 'oYWLe07PI6uEk+z33fr9oo1fSACGQ5s6jddFapZ+DjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030