UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkcrs1qcD1vzXPZDdqtt6Inu2DNt6PGvnnyW392/QzI=' 
WHERE 
  key_id = '20fb0cf935820183cf6fd3c992ff8838c72852fb510e8244c824af2b7da4892f' 
  AND (
    token = 'gkcrs1qcD1vzXPZDdqtt6Inu2DNt6PGvnnyW392/QzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038