UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yH3yLHVPFGl8r648QhLpnFLjgaEz8XjrRdpyDxz+P3U='
WHERE
key_id = '97b79fca00071b1cea473c2f466b96fb246a9e44ff417819dedb56d4202a41d0'
AND (
token = 'yH3yLHVPFGl8r648QhLpnFLjgaEz8XjrRdpyDxz+P3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)