UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TdcI8gLr4xShl3KBOeG1Sj0mVGh/70mxf7dqLT1EL6k='
WHERE
key_id = '8475e0b6a8400ec9224291b768729d2700f64337ce90e10776634149d43fd398'
AND (
token = 'TdcI8gLr4xShl3KBOeG1Sj0mVGh/70mxf7dqLT1EL6k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)