UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '57EHNgueqQk30LFPu8Nrxqw3ICeQa2Io7zzl93tikpY=' 
WHERE 
  key_id = '6d9916401886c533a0141549a92b67d094e50e544c9ab434ac445be56b638de5' 
  AND (
    token = '57EHNgueqQk30LFPu8Nrxqw3ICeQa2Io7zzl93tikpY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022