UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xw0gT3Ne83SxFWWd0WaXseUSZot+FzacFSAdI6U+TmA='
WHERE
key_id = '82feeaff45dfe5165bcd878002ebd890cf10578cf23dd9387f3b3975149e9012'
AND (
token = 'Xw0gT3Ne83SxFWWd0WaXseUSZot+FzacFSAdI6U+TmA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)