UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c960kXfJASN6oxonrLq3B/YKFrPfL3W8pJXtQU1uYCg='
WHERE
key_id = 'a39816e0ea798acb7462ae732d56c1f0882624637d095cca2b374b8ace6144ef'
AND (
token = 'c960kXfJASN6oxonrLq3B/YKFrPfL3W8pJXtQU1uYCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)