UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dLiFzOjfc4F83TTve+eUaroY/WO/Mb3Dc0eWQesA6WA=' 
WHERE 
  key_id = 'c4662621913a35ba9923293cf48174f9baf590e1e270bcf30ae3d2909e0dbbfe' 
  AND (
    token = 'dLiFzOjfc4F83TTve+eUaroY/WO/Mb3Dc0eWQesA6WA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046