UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'stiA8tXwMMX0NCjoDP4Vzj943qi4r5S78sP+S1kcHfo='
WHERE
key_id = 'd98202f58d22e8a9df6d31a95cb650f38e12093900548b820ca1eab3b74a01a9'
AND (
token = 'stiA8tXwMMX0NCjoDP4Vzj943qi4r5S78sP+S1kcHfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)