UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uPOrSNpCJTIN2DoXsFRm0DsAEeFeLyf//GetdFHCSew='
WHERE
key_id = '51b1cdac3b8fc38950f34cd302c895783daaf044658b8668162b40f9d257ea74'
AND (
token = 'uPOrSNpCJTIN2DoXsFRm0DsAEeFeLyf//GetdFHCSew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)