UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W0DpXRiVwZQ4Dwh7nVS2lU6WWKDcGNhSAUphTA07GrE='
WHERE
key_id = 'cff17a640efed92eff6b2efed33a4b060a335eb8cb6e7b7d279f50b5488fd7ea'
AND (
token = 'W0DpXRiVwZQ4Dwh7nVS2lU6WWKDcGNhSAUphTA07GrE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)