UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XyGnHO1xkz2TnkUh9lBz6pSa2kuZIXs+++uSFkJUbxg=' 
WHERE 
  key_id = '94916958aec14171c50ecc05fc36c172f17e35e01b2385f50f33face03a4e99b' 
  AND (
    token = 'XyGnHO1xkz2TnkUh9lBz6pSa2kuZIXs+++uSFkJUbxg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041