UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/DFSf6m3JfMR5mViJncoXIXCZVUJR8dLwLaR7lOHPA=' 
WHERE 
  key_id = '42c31d0572771c3a48d3b525776d05c903a2179449854b3b10b37c1c632887c6' 
  AND (
    token = 'p/DFSf6m3JfMR5mViJncoXIXCZVUJR8dLwLaR7lOHPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038