UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gIL5kUYvjis5tUAaSd7WBEd+xeJwRyMeA6D2+yqoNL0='
WHERE
key_id = '542995973f342032056727d36a1cfc3de26f23bc2280957a1fa7b951bb1d01cc'
AND (
token = 'gIL5kUYvjis5tUAaSd7WBEd+xeJwRyMeA6D2+yqoNL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)