UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NFYn1HxIbB2cOPEQ7cE2k0aDYo9Tnpp/69KZQXgCfhs=' 
WHERE 
  key_id = 'a854dc6b01684761a501002805c942613a9ac3ad9265b932c4bb215b0d4dbc6f' 
  AND (
    token = 'NFYn1HxIbB2cOPEQ7cE2k0aDYo9Tnpp/69KZQXgCfhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034