UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x+9HJZ2SFAdHDEmnJ8E0ihoUFzoQ2OqV8kKwGJUxxyU='
WHERE
key_id = '964cd99e0618f0717e4ebf3a9539a70d41264ef0651a123c2c0c418faed92d5a'
AND (
token = 'x+9HJZ2SFAdHDEmnJ8E0ihoUFzoQ2OqV8kKwGJUxxyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)