UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AIXdj8eGpfTvnsMBJjKBGJbG+SPlCbIrqMgggSrYin4='
WHERE
key_id = 'e2e08fd6e2f1a9cb77d984456b1654bc31f69e93c94fc3a58e0141b6721e2c05'
AND (
token = 'AIXdj8eGpfTvnsMBJjKBGJbG+SPlCbIrqMgggSrYin4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)