UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nyRouf2aWtGC2U/bMnnCBAHHDDqjuuAj45uxLvy0LF4='
WHERE
key_id = 'fff147398eeddc2530956980321d5fa8db1518e9b01b41c3663a919f4373f401'
AND (
token = 'nyRouf2aWtGC2U/bMnnCBAHHDDqjuuAj45uxLvy0LF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)