UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rXfgJQQxejTNS0kuxuLLiADDnRmAyGPFsrb3430YTsc=' 
WHERE 
  key_id = '68fb2112896e507b30679e099d76890e6b3bf5d31b32d16a3c756a1b336ad817' 
  AND (
    token = 'rXfgJQQxejTNS0kuxuLLiADDnRmAyGPFsrb3430YTsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047