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