UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'afZyLAoS1BpkGMuiqgA+4Ca9i+yadEu47DFmBRBRiHg=' 
WHERE 
  key_id = '105acbe644d1023230ebeaf24afd0fa042da0431285c0a27ba3b813417210a38' 
  AND (
    token = 'afZyLAoS1BpkGMuiqgA+4Ca9i+yadEu47DFmBRBRiHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030