UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GmaDzp+dDQRe5ZON6aPIaCc+LTXjqnIgOczcPESVoHU=' 
WHERE 
  key_id = 'b08139f35916289f182f95e3500435abf6b8a319eb6f4c64c923700037480903' 
  AND (
    token = 'GmaDzp+dDQRe5ZON6aPIaCc+LTXjqnIgOczcPESVoHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044