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