UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FjsISQXSKWs5lirgLhNBpkxdroSPjdcTGPUqwpfmv58=' 
WHERE 
  key_id = '59d7fe09eb552a851e3b35427b97867617c5e3c86f91bc9d720c02b0527d5a65' 
  AND (
    token = 'FjsISQXSKWs5lirgLhNBpkxdroSPjdcTGPUqwpfmv58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027