UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1kd6FaaO9zlejTLSUeM/G3/1dh+fq5y/NqjmiPMzo0=' 
WHERE 
  key_id = '599d486538725ba6f9bbd8cd9abb6abf109858aa5e4259781c9d10d6c3301bb1' 
  AND (
    token = 'e1kd6FaaO9zlejTLSUeM/G3/1dh+fq5y/NqjmiPMzo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037