UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hW/Dv5jhJIHmluk7BDA30eFc5Xiun4P6tMbMjenJCO4='
WHERE
key_id = '5006c69b6ed799f148544adb2b9542ec97be23f336dd66a77a2b0219f2f70b3d'
AND (
token = 'hW/Dv5jhJIHmluk7BDA30eFc5Xiun4P6tMbMjenJCO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)