UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jPos0j+ynsb3iI+diyG/T4H+HSv3H7lD3WUyxBjGaN4='
WHERE
key_id = '46b60197185e7610f93c182366cb09632c9e807e7190f10f3a047f2a4a32dcb0'
AND (
token = 'jPos0j+ynsb3iI+diyG/T4H+HSv3H7lD3WUyxBjGaN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)