UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qPOlD8aSWAN+Ti9JER5UYjOrs9cigJyjaXx5Ui5kpD8='
WHERE
key_id = 'e6ae303e1b88e02f3441e994a98078c56f303bde17f84a719bfc2e8d1eb739d6'
AND (
token = 'qPOlD8aSWAN+Ti9JER5UYjOrs9cigJyjaXx5Ui5kpD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)