UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O2DJxS2pQribkg3axMxFpeIdgB51vtOgirPV3PpEHAQ='
WHERE
key_id = 'b1c04f41837980835d59c8907e9107cd38fe0fee4c0873565cc349e145bd90b6'
AND (
token = 'O2DJxS2pQribkg3axMxFpeIdgB51vtOgirPV3PpEHAQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)