UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bLq1kcQL1b5g7FsHknq2UPMetaT849tnWD0IFHyYQRM=' 
WHERE 
  key_id = '38e1a9500aced710ee348df9fc78d6dfb6a0ffcfbb58180bd984034b59e54fb4' 
  AND (
    token = 'bLq1kcQL1b5g7FsHknq2UPMetaT849tnWD0IFHyYQRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046