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