UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CAv63i4ayHALCkCcJE/X1RozGlAxfWoVmvZmtmi8JNA='
WHERE
key_id = '7ef431bab25e77a333e1db1cd84bc0d39d34dd5e9250425b63f7b9ca92e8be6e'
AND (
token = 'CAv63i4ayHALCkCcJE/X1RozGlAxfWoVmvZmtmi8JNA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)