UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DD1z10vOmLfy0vkzWni91DlQlXiN0xB7A1MSUhtLMoM='
WHERE
key_id = '1e9319953f5a303f6775df41def7d726e46d3da5c76476144771b4ae701c9fed'
AND (
token = 'DD1z10vOmLfy0vkzWni91DlQlXiN0xB7A1MSUhtLMoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)