UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tCwx8x1LMfn73GX+5DIFsSFeG7zDku1W2Tf3/kpB/5E='
WHERE
key_id = 'aaaa1e7d505172482a34657029b1c358f1bf3352897543114783f8422540918e'
AND (
token = 'tCwx8x1LMfn73GX+5DIFsSFeG7zDku1W2Tf3/kpB/5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)