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