UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7utrwcFZAyfxl5RAMBJNwjNViYsfwVCCmXdfKJcuNB0='
WHERE
key_id = '6d74aeefe170b3672514ec1e06d9c1532a9e4fc1efe7fba9c536df0469ed8cfc'
AND (
token = '7utrwcFZAyfxl5RAMBJNwjNViYsfwVCCmXdfKJcuNB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)