UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C83vwCNTMRL2I2WgPaVSGNM6Fq0+MOgpeyD5V1D+A04=' 
WHERE 
  key_id = '038bc4ba9375630f45fb37b480dc718638f101e497251a604445161e1be4b661' 
  AND (
    token = 'C83vwCNTMRL2I2WgPaVSGNM6Fq0+MOgpeyD5V1D+A04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019