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