UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Psk2LIFOTG9wGXbViC9d6T3aSIVGe+VIxZp5soDbXs='
WHERE
key_id = '5a5162fcc0b2712e4e5bd9112230d2439e1d990ac0bf37205c3403a8cb8a1ed1'
AND (
token = '7Psk2LIFOTG9wGXbViC9d6T3aSIVGe+VIxZp5soDbXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)