UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JLaltWa2njJORqgnf3eEAXT/DXK7pWHB3x7JNFGQNOw='
WHERE
key_id = '851fc957076234ee37817ce6e5f6308831d0cb7e13dd02848a72f152851db955'
AND (
token = 'JLaltWa2njJORqgnf3eEAXT/DXK7pWHB3x7JNFGQNOw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)