UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ERixZE2Xl6HrtZNfiTH4FdnO8rJI0ZulrApycMaFOx0=' 
WHERE 
  key_id = '15e382034419ce81d4aafee4e8e08d029d679ea2f7117ca968a0552b6da37e16' 
  AND (
    token = 'ERixZE2Xl6HrtZNfiTH4FdnO8rJI0ZulrApycMaFOx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046