UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ufoN9KeeroTYWGoUzuoJjl0pW4fL1P9ZR36M3f6c67s='
WHERE
key_id = '72f0c8c6069548a0ad7bc81c946c9e40133b93e217d38744826ca141c403ecdf'
AND (
token = 'ufoN9KeeroTYWGoUzuoJjl0pW4fL1P9ZR36M3f6c67s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)