UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MsUTBF1/T3mbGXiMCpVOi1JAcyQ+3NKElMdZqrdB8ro='
WHERE
key_id = 'cdede33d4abafe2b1a521efb381885f1ed00a1586d11b57a0ff3e0b236888ce1'
AND (
token = 'MsUTBF1/T3mbGXiMCpVOi1JAcyQ+3NKElMdZqrdB8ro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)