UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MhtD8zCGTxPk5QIK3iJ1+gslxfEy73eUyPYne1UAFnA='
WHERE
key_id = 'bba89c0872151ce7c80c298d51becee0f5b7d1609d61e605dba8576465995eba'
AND (
token = 'MhtD8zCGTxPk5QIK3iJ1+gslxfEy73eUyPYne1UAFnA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)