UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zaREvS0hGPUifEnB0EaUnNqGgoqEx61rgBKmBgcn4zo=' 
WHERE 
  key_id = '0b32cfc00dba1938065d97889851d60f136f183b832c61cac052e1a314a25037' 
  AND (
    token = 'zaREvS0hGPUifEnB0EaUnNqGgoqEx61rgBKmBgcn4zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057