UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wPL+MkRgGPlExn6mfYYRcPRGVs23y82bUvrWWjIdDf4='
WHERE
key_id = 'eae1bbda1874675032a4859c19acbda0b97bd49c2fe52143257c19b072f0e1ff'
AND (
token = 'wPL+MkRgGPlExn6mfYYRcPRGVs23y82bUvrWWjIdDf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)