UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gbeQgG2yY05LT5Wy+hc6I3P/p4M5D+oDW9Fc/PMgJB4='
WHERE
key_id = '8689abc8d07032faa8665e4d3a60e47fe02402d159826ea1012aeabc56fe2918'
AND (
token = 'gbeQgG2yY05LT5Wy+hc6I3P/p4M5D+oDW9Fc/PMgJB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)