UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JNTZE7Siu26/njPHqKmvGHxl2A5AHTm7dJvbjstqrbI='
WHERE
key_id = 'ae1eeb0020c3b7f8d6433434caf3df0350c2d26c6db0f339c545d6fa53a4def8'
AND (
token = 'JNTZE7Siu26/njPHqKmvGHxl2A5AHTm7dJvbjstqrbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)