UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't7MenF6iFfVyujOY4ushL6BIrNYiuXnhD9T9+xJFpYM='
WHERE
key_id = 'beb56550f4fb0dcd09edddc2b273c5591251995970494ea739ce04131f34ea75'
AND (
token = 't7MenF6iFfVyujOY4ushL6BIrNYiuXnhD9T9+xJFpYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)