UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VHhepya6eeo1BA72QHV3mVKuFDKJY7lCPR1FGStaVeU='
WHERE
key_id = '3a899e77ce67468fb4192abadc34a33a0de9df8bf05561e4daa880519f5217f2'
AND (
token = 'VHhepya6eeo1BA72QHV3mVKuFDKJY7lCPR1FGStaVeU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)