UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n7ddLuDxctMBfnAz1djwVq2LGal2eroUVgsXfAPgykk='
WHERE
key_id = '9b94ae130a97c37b04fe482fd4dd2cffa53207faeb4a4fb2eb3c188d4a08b029'
AND (
token = 'n7ddLuDxctMBfnAz1djwVq2LGal2eroUVgsXfAPgykk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)