UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AlpHjYG3kLxykj/AvicckcGoCtLKfOGk68STifbsxuA='
WHERE
key_id = 'c4321a0081ae9f3e34c934db7c545f0acbebeb943a555e200e74e28fd1cbf105'
AND (
token = 'AlpHjYG3kLxykj/AvicckcGoCtLKfOGk68STifbsxuA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)