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