UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CUF6LC+XOb51m3aXsQIyXg3q5VaBUSBKgB+n8e4FVtg='
WHERE
key_id = 'd89212e867e088a62d5b354d343964bc0248c41b597b7f7fd9b3881839eb3b82'
AND (
token = 'CUF6LC+XOb51m3aXsQIyXg3q5VaBUSBKgB+n8e4FVtg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)